﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading;
using System.Web;

/// <summary>
/// ExamPay 的摘要说明
/// </summary>
public static class ExamPay
{

    public static void StartNewThread()
    {
        ThreadPool.QueueUserWorkItem(new WaitCallback(startIndexManage));
    }

    //循环查询数据库中是否有更改的数据，并处理索引管理器中的数据
    public static void startIndexManage(object state)
    {
        DataTable dt = Exam.GetOrderListByDays(20);
        if (dt.Rows.Count > 0)
        {
            foreach (DataRow dr in dt.Rows)
            {
                IndexQueueViewMode iqvm = new IndexQueueViewMode();
                iqvm.OrderID = dr["OrderID"].ToString();
                iqvm.EmYear = dr["EmYear"].ToString();
                iqvm.EmNum = dr["EmNum"].ToString();
                iqvm.Abstract = dr["StudIDCard"].ToString() + "-" + dr["StudName"].ToString();
                IndexManager.indexManage.Add(iqvm);
            }
            IndexManager.indexManage.Start();
        }
    }
}